<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<% String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html>
<head>
    <base href=<%=basePath%>
    <%@include file="../common_css.jsp"%>
</head>
<body class="childrenBody">
<form class="layui-form" style="width:80%;">
    <input name="cusId" type="hidden" value="${id}"/>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">跟进类型</label>
        <div class="layui-input-block">
            <select name="mode"  id="mode">

            </select>
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">跟进内容</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input userName"
                   lay-verify="required" name="content" id="content" value="" placeholder="请输入跟进内容">
    </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">执行效果</label>
        <div class="layui-input-block">
            <select name="result"  id="result">

            </select>
        </div>
    </div>


    <br/>
    <div class="layui-form-item layui-row layui-col-xs12">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-lg" lay-submit=""
                    lay-filter="addCusDevPlan">确认
            </button>
            <button class="layui-btn layui-btn-lg layui-btn-normal">复原</button>
        </div>
    </div>
</form>
<script>
    layui.use(['form', 'layer'], function () {
        var form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery;

        //添加
        form.on('submit(addCusDevPlan)',function (data) {
            var index = top.layer.msg("数据提交中,请稍后...",{icon:16,time:false,shade:0.8});
            var url = "/cusDevelop/insert";
            $.post(url,data.field,function (res) {
                if(res == 'success'){
                    top.layer.msg("操作成功");
                    top.layer.close(index);
                    layer.closeAll("iframe");
                    // 刷新父页面
                    parent.location.reload();
                }
            });
            return false;
        });

        $.post("/dictionaries/findDevelopResult",function (res) {
            //console.log(res)
            for(var i=0;i<res.length;i++){
                //绑定下拉框显示
                $("#result").append("<option value=\""+res[i].valueId+"\"   >"+res[i].valueName+"</option>");
            }
            // 重新渲染下拉框内容
            layui.form.render("select");
        });
        $.post("/dictionaries/findDevelopMode",function (res) {
            //console.log(res)
            for(var i=0;i<res.length;i++){
                //绑定下拉框显示
                $("#mode").append("<option value=\""+res[i].valueId+"\"   >"+res[i].valueName+"</option>");
            }
            // 重新渲染下拉框内容
            layui.form.render("select");
        });

    });
</script>
</body>
</html>
